// ================================================
// ============== Script by Micha =================
// ================================================

game_manager
{
	spawn
	{

		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	30
		wm_number_of_objectives 5
		wm_set_round_timelimit	12

		// Objectives
		// 1: Primary1 : Destroy the Crypt
		// 2: Primary2 : Steal The Gold
		// 3: Primary3 : Escape with the gold
		// 4: Secondary1 : Capture forward spawn point
		// 5: Allied command post
		// 6: Axis command post


		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_objective_status 4 1 0
		wm_objective_status 4 0 0
		wm_objective_status 5 1 0
		wm_objective_status 5 0 0
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
		wm_objective_status 7 1 0
		wm_objective_status 7 0 0

		// Set Defending Team for SW Mode

		wm_set_defending_team	0

		wait 50
		disablespeaker axis_cp_sound
		disablespeaker allied_cp_sound
		setstate flag_trigger invisible
		setstate northflag_cm_marker invisible
		setstate northcourtyard invisible

		// If the round timer expires, the Nazis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 0

		// Set autospawn markers <team (0 = axis, 1 = allies)> <message key of marker>
		// Spawns on siwa:
		// Axis Garrison
		// Allied Camp
		// Old City
		wait 150

		setautospawn	"Allied Spawn"				1

		wait 450

		// start triggered loops on/off as required (eg: command post radio sounds)
		disablespeaker som_flag
	}


	trigger objective1
	{
		accum 2 set 1
	}

	trigger axis_object_stolen
	{
		wm_objective_status 		2 0 2
		wm_objective_status 		2 1 1
	}

	trigger axis_object_returned
	{
		wm_objective_status 		2 0 1
		wm_objective_status 		2 1 0
	}

	trigger checkgame
	{ 
		accum 2 abort_if_not_equal 1
		wm_setwinner 1

		wait 1500
		wm_endround
	}

}


truckend
{
	spawn
	{
	}
	death
	{
	trigger game_manager objective1
	}
}


blowcryptwall
{
	spawn
	{
		wait 200
		remove
	}

	death
	{
	}
}



// ================================================
// ============    FORWARD SPAWN     ==============
// ================================================

northflag
{
	spawn
	{
	accum 3 set 2	// 0-Axis, 1-Allied
	remove
	}


	trigger axis_capture
	{
	}

	trigger allied_capture
	{
	}

}


// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================

allied_compost_built
{
	spawn
	{
		wait 400
		setstate neutral_compost_built invisible
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
		enablespeaker allies_compost_sound
	}

	trigger setup
	{
	}

	buildstart final
	{
	}

	built final
	{
	}

	decayed final
	{
	}

	death
	{
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
	}

	trigger disable_allied_features
	{
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	trigger setup
	{
	}

	buildstart final
	{
	}

	built final
	{
	}

	decayed final
	{
	}

	death
	{
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
	}

	trigger disable_axis_features
	{
	}
}